<extend name="Base/common"/>
<block name="style">
    <link href="__CSS__/reset_index.css" rel="stylesheet" />
    <link href="__CSS__/index.css" rel="stylesheet">
    <style>
        .registerform li{
            padding-bottom:25px;
            zoom: 1;
            overflow: hidden;
        }
        .registerform .label{
            display:block;
            width:90px;
            margin: 0;
            font-size: 14px;
            color: #444444;
            padding-top: 4px;
            padding-right: 5px;
            float: left;
            text-align: right;
        }
        .registerform .inputxt{
            border: 1px solid #ccc;
            width:300px;
            float: left;
        }
        .action{
            margin-top: 30px;
            margin-bottom: 20px;
        }
        .yzmsubinput{
            -webkit-border-radius: 0;
            -moz-border-radius: 0;
            border-radius:0
        }
        .yzmsub{
            padding-left: 82px;
        }

        .bixu{
            margin-left: 5px;
            color: red;
            font-weight: bold;
        }
    </style>
</block>
<block name="body">
    <div class="warrper">
        <div class="header">
            <div class="clearFloat" style="width: 830px;margin: 0 auto;">
                <div class="xglogo floatLeft">
                    <a href="{:U('Index/index')}"><img src="__IMG__/index/xglogo.png" alt=""/></a>
                </div>

                <div class="nav floatRight" style="width: 520px;margin-left: 100px;">
                    <ul class="clearFloat">
                        <li>
                            <a href="{:U('Index/student')}" class="xgactive">信息填报</a>
                        </li>
                        <li>
                            <a href="{:U('Report/studentReport')}">入学报到</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <!--content-->
        <div class="content">
            <div class="xgright" style="margin: 0 auto;">
                <h3 class="xgrighth3">学生信息填报</h3>
                <div class="xgrightcont">
                    <form class="registerform">
                        <ul>
                            <input type="hidden" name="id"  value="{$data.id}" />
                            <li>
                                <label class="label">姓名：</label>
                                <input type="text" value="" name="name" class="inputxt" />
                                <span class="bixu">*</span>
                            </li>
                            <li>
                                <label class="label">身份证号：</label>
                                <input type="text" value="" name="ID_number" class="inputxt" />
                                <span class="bixu">*</span>
                            </li>
                            <li>
                                <label class="label">联系电话：</label>
                                <input type="text" value="" name="mobile" class="inputxt" />
                                <span class="bixu">*</span>
                            </li>
                            <li>
                                <label class="label">性别：</label>
                                <input type="radio" name="sex" checked value="0">男
                                <input type="radio" name="sex" value="1">女
                                <span class="bixu">*</span>
                            </li>
                            <li>
                                <label class="label">感兴趣专业：</label>
                                <select name="major" class="sewidth">
                                    <volist name="major" id="vo">
                                        <option value="{$vo.id}">{$vo.title}</option>
                                    </volist>
                                </select>
                                <span class="bixu">*</span>
                            </li>
                            <li>
                                <label class="label">家庭住址：</label>
                                <input type="text" value="{$data.home_address}" name="home_address" class="inputxt" />
                            </li>
                            <li>
                                <label class="label">毕业学校：</label>
                                <input type="text" value="{$data.school}" name="school" class="inputxt" />
                            </li>

                        </ul>
                        <div class="action">
                            <div class="clearFloat">
                                <div class="yzmsub floatLeft">
                                    <input type="button" value="提交" class="yzmsubinput"/>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </div>
        <!--content end-->
    </div>
    <!--warrper end-->
</block>

<block name="script">
    <script type="text/javascript">
        $(function(){
            $(".yzmsubinput").click(function(){
                var $name=$("input[name=name]").val(),
                    $ID_number=$("input[name=ID_number]").val(),
                    $mobile=$("input[name=mobile]").val();

                if($name==''){
                    layer.msg("请填写名字");
                    return false;
                }

                if($ID_number==''){
                    layer.msg("请填写身份证号");
                    return false;
                }

                if($mobile==''){
                    layer.msg("请填写手机号");
                    return false;
                }

                if($mobile!=''){
                    var m_re = /^1\d{10}$/
                    if (!m_re.test($mobile)) {
                        layer.msg("手机号格式错误！");
                        return false;
                    }
                }
                $(".yzmsubinput").attr('disabled',true);
                if($ID_number!=''){
                    var reg = /^[1-9]{1}[0-9]{14}$|^[1-9]{1}[0-9]{16}([0-9]|[xX])$/;
                    if(reg.test($ID_number)){
                        $.post('{:U("Index/checkfield")}', {ID_number:$ID_number}, function(data){
                            if(data.status){
                                layer.msg(data.info);
                                return false;
                            }else{
                                $.post('{:U("Index/saveData")}', $("form").serialize(), function(data){
                                    if(data.status){
                                        layer.msg(data.info)
                                        setTimeout(function () {
                                            location.reload();
                                        },1000);
                                    }else{
                                        layer.msg(data.info);
                                    }
                                });
                            }
                            $(".yzmsubinput").attr('disabled',false);
                        });
                    }else{
                        $(".yzmsubinput").attr('disabled',false);
                        layer.msg("身份证号格式不正确");
                        return false;
                    }
                }


            })


        });
    </script>

</block>
